# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=emacs-jabber
pkgver=0_git20240624
_gitrev=e766d84b81d5df6abc30fcbbb94f7c8640ea54e2
pkgrel=0
_pkgreal=jabber
pkgdesc="Jabber/XMPP client for Emacs"
url="https://codeberg.org/emacs-jabber/emacs-jabber"
arch="noarch"
license="GPL-2.0-or-later"
depends="
	cmd:emacs
	emacs-fsm
	emacs-srv
	"
makedepends="emacs-nox"
source="$pkgname-$_gitrev.tar.gz::https://codeberg.org/emacs-jabber/emacs-jabber/archive/$_gitrev.tar.gz"
builddir="$srcdir/$pkgname/lisp"

prepare() {
	default_prepare
	cp -v ../jabber-ourversion.el .
}

build() {
	emacs -batch -q -no-site-file -L . \
		-eval '(setq print-length nil load-prefer-newer t)' \
		-f batch-byte-compile \
		./*.el
}

check() {
	local tests="load-all.el skip-tag-forward.el history.el
			jabberd.el nick-change-fail.el
			caps-hash.el parse-next-stanza.el
			"

	export top_builddir="$builddir"
	local test; for test in $tests; do
		msg "Running tests from $test"

		emacs -batch -q -no-site-file -L . \
			-L ../tests -l "../tests/$test"
	done
}

package() {
	install -Dvm644 ./*.el ./*.elc \
		-t "$pkgdir"/usr/share/emacs/site-lisp/$_pkgreal/

	cd "$pkgdir"/usr/share/emacs/site-lisp/$_pkgreal
	emacs -batch -q -no-site-file \
		-eval "(loaddefs-generate \".\" \"$_pkgreal-loaddefs.el\")"
}

sha512sums="
c3d4532d80762fec37d70f95970f85efed9bfcfa875d367874c83c9086d90886355db300da893e264d1e6081a7769d9a3bfbc462a8113e8aa86b1fdb8fda1ded  emacs-jabber-e766d84b81d5df6abc30fcbbb94f7c8640ea54e2.tar.gz
"
